const express = require("express");
const app = express();
var cookie_parser = require("cookie-parser");
const body = require("body-parser");
var pro = express.Router();
pro.get("/get", function (req, res) {
  res.send("服务器请求了/get 线上");
});
pro.get("/list", function (req, res) {
  res.json({
    msg: "服务器123 线上",
  });
});
pro.post("/add", function (req, res) {
  res.send("服务器请求了 /add 线上");
});
app.use("*", function (req, res, next) {
  next();
});
app.use("/public", express.static("public"));
app.use(body.json()); //body-parser 解析json格式数据
app.use(cookie_parser());
app.use("/prod-api", pro);
app.listen(5001, function () {
  console.log("启动");
});
